﻿using System;
using System.Text;

namespace dotHTML.HTML {
    /// <summary>
    /// Represents an ordered list of elements.
    /// </summary>
    [Serializable]
    public class Ol : Element {
        private bool _compact;
        private bool _reversed;
        private int? _start;
        private ListTypeChoices? _type;

        /// <summary>
        /// Determines whether the list is displayed in a compact form.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public bool Compact {
            get { return _compact; }
            set { _compact = value; }
        }

        /// <summary>
        /// Determines whether the items are specified in reverse order.  
        /// </summary>
        public bool Reversed {
            get { return _reversed; }
            set { _reversed = value; }
        }

        /// <summary>
        /// Determines the starting numeral of this ordered list.
        /// </summary>
        public int? Start {
            get { return _start; }
            set { _start = value; }
        }

        /// <summary>
        /// Determines the numbering type of this ordered list.
        /// </summary>
        [Obsolete("Deprecated in HTML4 - use CSS instead.")]
        public ListTypeChoices? Type {
            get { return _type; }
            set { _type = value; }
        }

        /// <summary>
        /// Gets a formatted string of all child elements of this element.
        /// </summary>
        /// <param name="sb">The StringBuilder to write this element's child
        /// data to.</param>
        protected override void WriteLocalAttributes(StringBuilder sb) {
            AttributeWriter.Write(sb, _compact, "compact");
            AttributeWriter.Write(sb, _reversed, "reversed");
            AttributeWriter.Write(sb, _start, "start");
            AttributeWriter.Write(sb, (char?)_type, "type");
        }
    }
}
